package com.zerous.staria.screens;
import com.zerous.framework.*;
import com.zerous.staria.*;
import java.io.*;

public class ResLoadScreen extends Screen
{
	public ResLoadScreen(Game g)
	{
		super(g, null);
	}

	@Override
	public void update()
	{
		Images.LOGO = Zex.graphics.newPixmap("logo.png", Graphics.PixmapFormat.ARGB8888).scale(15);
		Images.ONE = Zex.graphics.newPixmap("o.png", Graphics.PixmapFormat.ARGB8888).scale(10);
		Images.TWO = Zex.graphics.newPixmap("t.png", Graphics.PixmapFormat.ARGB8888).scale(10);
		Images.THR = Zex.graphics.newPixmap("th.png", Graphics.PixmapFormat.ARGB8888).scale(10);
		Images.BACK = Zex.graphics.newPixmap("back.png", Graphics.PixmapFormat.ARGB8888).scale(10);
		Images.BACK_D = Zex.graphics.newPixmap("back_d.png", Graphics.PixmapFormat.ARGB8888).scale(10);
		Images.LABEL = Zex.graphics.newPixmap("label.png", Graphics.PixmapFormat.ARGB8888).scale(Zex.Const.width, (Zex.Const.px * 16)/3);
		
		Res.testLayout = load_text("layout/test.json");
		Res.gameControler = load_text("layout/main.json");
		
		game.setScreen(new MainScreen(game, null));
	}

	@Override
	public void render()
	{
		// TODO: Implement this method
	}
	
	private String load_text(String fileName)
	{
		StringBuilder result = new StringBuilder();
		try
		{
			BufferedReader bf = new BufferedReader(new InputStreamReader(Zex.file.readAsset(fileName)));
			String line = null;
			while((line = bf.readLine()) != null)
			{
				result.append(line);
			}
			bf.close();
		}
		catch(IOException e)
		{
			
		}
		return result.toString();
	}
}
